﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeFile="AddProduction.aspx.cs" Inherits="Admin_AddProduction" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

 <script type="text/javascript">


     $(function () {
         dark.form({
             appendTo: $(".form2"),
             title: "添加产品",
             data: {},
             width: 900,
             items: [
				{ id: "Title", label: "标题", type: "textbox", required: true, width: 700 },
                { id: "Message", label: "内容", type: "editor", required: true, width: 700, height: 400 },
                { id: "submit", label: "添加", type: "submit", iconCls: "icon-save", url: "",
                    onClick: function (isValid, formData) {
                        var loadDialog = $.dialog.tips('正在验证客户资料...', 700, 'loading.gif');
                        var isExist = DarkCRM.Production.CheckCustomExist(formData).ErrorCode > 0;
                        if (isExist) {
                            loadDialog.close();
                            $.dialog({
                                icon: 'error.gif',
                                content: '对不起，该客户已经存在!',
                                title: "失败"
                            });
                        } else {
                            var loadDialog = $.dialog.tips('正在保存客户资料...', 700, 'loading.gif');
                            DarkCRM.Production.Create(formData, { success: function (result) {
                                    if (result.ErrorCode == 0) {
                                        $.dialog({
                                            icon: 'success.gif',
                                            content: '添加成功!',
                                            title: "成功"
                                        });
                                    } else {
                                        $.dialog({
                                            icon: 'error.gif',
                                            content: '对不起，添加失败!',
                                            title: "失败"
                                        });
                                    }
                                }
                            });
                        }
                        
                    },
                    success: function (isValid, data) {
                        success(data);
                    },
                    onLoadError: function () {
                    }
                }
                ]
         });
     });

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <div class="form2">
    </div>
    
</asp:Content>

